<?php
class Admin_Form_TinTucForm extends Zend_Form
{
	public function __construct($option = null)
	{
		parent::__construct($option);
		ZendX_JQuery::enableForm($this);
		$this->setName('chude');
		
		$tentintuc = new Zend_Form_Element_Text('tentintuc');
		$tentintuc->setLabel('Tên tin tức:')
				->setOptions(array('class' => 'inp-form'))
			   ->setRequired(true);
		$machude = new Zend_Form_Element_Select('machude');
		$machude->setLabel('Chủ đề:')
				   ->setRequired(true);
		$chudeMapper = Data_Model_ChuDeMapper::getInstance();
		$chudes = $chudeMapper->chudeList();
		foreach($chudes as $chude)
		{
			$machude->addMultiOptions(array(
					$chude->getId() => $chude->getTenchude()
			));
		}
		
		$tomtat = new Zend_Form_Element_Textarea('tomtat');
		$tomtat->setLabel('Tóm tắt :')
		->setAttribs(array(
				'cols' => '40',
				'rows' => '5'
		));
		
		$noidung = new Zend_Form_Element_Textarea('noidung');
		$noidung->setLabel('Nội dung :')
		->setAttribs(array(
				'cols' => '40',
				'rows' => '5'
		));
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setOptions(array('class' => 'form-submit'));
		$reset = new Zend_Form_Element_Reset('reset');
		$reset->setOptions(array('class' => 'form-reset'));
		
		$this->addElements(array($tentintuc,$machude,$tomtat,$noidung,$submit,$reset));
		/* foreach($this->getElements(array($submit,$reset)) as $element)
		{
			$element->removeDecorator('DtDdWrapper');
		} */
	}
}